package com.whz.gateway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import reactor.netty.ReactorNetty;

/**
 * @author whz
 */
@EnableDiscoveryClient
@SpringBootApplication
public class GatewayApplication {
    static {
        // netty access logs
        System.setProperty(ReactorNetty.ACCESS_LOG_ENABLED, "true");
        /*
         * connection select spec, 后进先出, 选择的链接都是最新鲜的,closed的可能性最低
         * 微服务的idle时间事件应该比gateway略大,确保gateway复用的connection是有效的
         */
        System.setProperty(ReactorNetty.POOL_LEASING_STRATEGY, "lifo");

        // heart beat sentinel as net gateway
        System.setProperty("csp.sentinel.app.type", "1");
    }

    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}